package com.demo.factory.simple;

/**
 * @Author likz
 * @Date 2025/7/23 15:37
 * @Description
 **/
public class SimpleFactoryCreate {

    public static SimpleFactory getFactory(String type)
    {
        if ("apple".equals(type))
        {
            return new AppleFood();
        }
        else if ("banlan".equals(type))
        {
            return new BanlanFood();
        }
        else
        {
            return null;
        }
    }


    public static void main(String[] args) {
        SimpleFactory simpleFactory = SimpleFactoryCreate.getFactory("apple");
        simpleFactory.createFood();

        SimpleFactory banlan = SimpleFactoryCreate.getFactory("banlan");
        banlan.createFood();
    }
}
